CVE-2026-1839
Arbitrary Code Execution via Unsafe torch.load() in Trainer Checkpoint Loading in huggingface/transformers
Description
A vulnerability in the HuggingFace Transformers library, specifically in the `Trainer` class, allows for arbitrary code execution. The `_load_rng_state()` method in `src/transformers/trainer.py` at line 3059 calls `torch.load()` without the `weights_only=True` parameter. This issue affects all versions of the library supporting `torch>=2.2` when used with PyTorch versions below 2.6, as the `safe_globals()` context manager provides no protection in these versions. An attacker can exploit this vulnerability by supplying a malicious checkpoint file, such as `rng_state.pth`, which can execute arbitrary code when loaded. The issue is resolved in version v5.0.0rc3.
INFO
Published Date :
April 7, 2026, 6:16 a.m.
Last Modified :
April 28, 2026, 4:39 p.m.
Remotely Exploit :
No
Source :
[email protected]
CVSS Scores
| Score | Version | Severity | Vector | Exploitability Score | Impact Score | Source |
|---|---|---|---|---|---|---|
| CVSS 3.0 | MEDIUM | [email protected] | ||||
| CVSS 3.0 | MEDIUM | MITRE-CVE | ||||
| CVSS 3.1 | HIGH | [email protected] |
Solution
- Update HuggingFace Transformers library to version v5.0.0rc3 or later.
- Ensure PyTorch version is compatible with loaded checkpoints.
- Avoid loading untrusted checkpoint files.
Public PoC/Exploit Available at Github
CVE-2026-1839 has a 3 public
PoC/Exploit available at Github.
Go to the Public Exploits tab to see the list.
References to Advisories, Solutions, and Tools
Here, you will find a curated list of external links that provide in-depth
information, practical solutions, and valuable tools related to
CVE-2026-1839.
| URL | Resource |
|---|---|
| https://github.com/huggingface/transformers/commit/03c8082ba4594c9b8d6fe190ca9bed0e5f8ca396 | Patch |
| https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485 | Exploit Third Party Advisory |
| https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485 | Exploit Third Party Advisory |
CWE - Common Weakness Enumeration
While CVE identifies
specific instances of vulnerabilities, CWE categorizes the common flaws or
weaknesses that can lead to vulnerabilities. CVE-2026-1839 is
associated with the following CWEs:
Common Attack Pattern Enumeration and Classification (CAPEC)
Common Attack Pattern Enumeration and Classification
(CAPEC)
stores attack patterns, which are descriptions of the common attributes and
approaches employed by adversaries to exploit the CVE-2026-1839
weaknesses.
We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).
Local RAG chatbot using Ollama + FAISS
Python CSS TypeScript JavaScript
Sistema de busca semântica de documentos utilizando embeddings e vector stores.
Python Dockerfile
None
Python
Results are limited to the first 15 repositories due to potential performance issues.
The following list is the news that have been mention
CVE-2026-1839 vulnerability anywhere in the article.
The following table lists the changes that have been made to the
CVE-2026-1839 vulnerability over time.
Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.
-
Initial Analysis by [email protected]
Apr. 28, 2026
Action Type Old Value New Value Added CVSS V3.1 AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H Added CPE Configuration OR *cpe:2.3:a:huggingface:transformers:5.0.0:rc0:*:*:*:*:*:* *cpe:2.3:a:huggingface:transformers:*:*:*:*:*:*:*:* versions up to (excluding) 5.0.0 *cpe:2.3:a:huggingface:transformers:5.0.0:rc1:*:*:*:*:*:* *cpe:2.3:a:huggingface:transformers:5.0.0:rc2:*:*:*:*:*:* Added Reference Type huntr.dev: https://github.com/huggingface/transformers/commit/03c8082ba4594c9b8d6fe190ca9bed0e5f8ca396 Types: Patch Added Reference Type CISA-ADP: https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485 Types: Exploit, Third Party Advisory Added Reference Type huntr.dev: https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485 Types: Exploit, Third Party Advisory -
CVE Modified by 134c704f-9b21-4f2e-91b3-4a467353bcc0
Apr. 07, 2026
Action Type Old Value New Value Added Reference https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485 -
New CVE Received by [email protected]
Apr. 07, 2026
Action Type Old Value New Value Added Description A vulnerability in the HuggingFace Transformers library, specifically in the `Trainer` class, allows for arbitrary code execution. The `_load_rng_state()` method in `src/transformers/trainer.py` at line 3059 calls `torch.load()` without the `weights_only=True` parameter. This issue affects all versions of the library supporting `torch>=2.2` when used with PyTorch versions below 2.6, as the `safe_globals()` context manager provides no protection in these versions. An attacker can exploit this vulnerability by supplying a malicious checkpoint file, such as `rng_state.pth`, which can execute arbitrary code when loaded. The issue is resolved in version v5.0.0rc3. Added CVSS V3 AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:L/A:H Added CWE CWE-502 Added Reference https://github.com/huggingface/transformers/commit/03c8082ba4594c9b8d6fe190ca9bed0e5f8ca396 Added Reference https://huntr.com/bounties/3c77bb97-e493-493d-9a88-c57f5c536485